package com.llianejapan.Quizz;

import java.io.BufferedReader;
import java.util.Vector;
import android.app.Activity;
import com.llianejapan.Types.QuizzType;
//The quizz Loader
public class QuizzL extends Activity {
	public static Vector<QuizzType> q;
	public static int qact;
	public static BufferedReader is;
	public static void load(){
		q = new Vector<QuizzType>();
		qact = 0;

		try {	
			String istr = "";
			//FILENAME
			istr = is.readLine();
			
			//Type Question
			while ((istr = is.readLine()) != null)
			{
				if (istr.equals("q"))
				{
					QuizzType qt = new QuizzType();
					qt.type = "q";
					qt.answers = new String[4];
					qt.question = is.readLine();
					qt.answers[0] = is.readLine();
					qt.answers[1] = is.readLine();
					qt.answers[2] = is.readLine();
					qt.answers[3] = is.readLine();
					q.add(qt);
				}
				else if (istr.equals("f"))
				{
					QuizzType qt = new QuizzType();
					qt.type = "f";
					qt.question = is.readLine();
					q.add(qt);
				}
				else if (istr.equals("d"))
				{	
					QuizzType qt = new QuizzType();
					qt.type = "d";
					qt.answers = new String[1];
					qt.question = is.readLine();
					qt.answers[0] = is.readLine();
					q.add(qt);
				}
				else if (istr.equals(""))
					continue;
			}
			is.close();			
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}		

	}
}
